﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 第三次作业
{
    class Triangle : Shape
    {
        public double area;
        public double edge1, edge2, edge3;
        public Triangle(double edge1,double edge2, double edge3)
        {
            this.edge1 = edge1;
            this.edge2 = edge2;
            this.edge3 = edge3;
            calculate();
        }
        public override void calculate()
        {
            double p = (edge1 + edge2 + edge3) / 2;
            area = Math.Sqrt(p * (p - edge1) * (p - edge2) * (p - edge3));
        }
        public override double getArea()
        {
            return area;
        }
        public override bool isTrue()
        {
            if ((edge1 + edge2 > edge3) && (edge1 + edge3 > edge2) && (edge2 + edge3 > edge1)
                && (edge1 > 0) && (edge2 > 0) && (edge3 > 0)) return true;
            else
                return false;
        }
    }
}
